﻿
using System;
using System.DHTML;
using Sys;
using seh = Sys.EventHandler;
using sea = Sys.EventArgs;
using SilverlightControlToolkit;
using System.Silverlight.Presentation;

namespace SilverlightControlToolkit.SampleScripts
{
    public class SampleScrolling : SLManager
    {
       
        public SampleScrolling(DOMElement host)
            : base(host)
        {
        }
        public override void OnSilverlightLoaded(System.Silverlight.SilverlightControl slControl, object args)
        {
            base.OnSilverlightLoaded(slControl, args);
            Button leftBtn = new Button();
            leftBtn.ElementName = "Left";
            leftBtn.Plugin = Plugin;
            leftBtn.Initialize();

            Button rightBtn = new Button();
            rightBtn.ElementName = "Right";
            rightBtn.Plugin = Plugin;
            rightBtn.Initialize();

            Button topBtn = new Button();
            topBtn.ElementName = "Top";
            topBtn.Plugin = Plugin;
            topBtn.Initialize();

            Button bottomBtn = new Button();
            bottomBtn.ElementName = "Bottom";
            bottomBtn.Plugin = Plugin;
            bottomBtn.Initialize();

            HorizontalPageFlipScroller scrollerHor = new HorizontalPageFlipScroller();
            scrollerHor.LeftButton = leftBtn;
            scrollerHor.RightButton = rightBtn;
            //HorizontalScrollBar scrollerHor = new HorizontalScrollBar();
            //scrollerHor.MinusBtn = leftBtn;
            //scrollerHor.PlusBtn = rightBtn;

            VerticalPageFlipScroller scrollerVert = new VerticalPageFlipScroller();
            scrollerVert.TopButton = topBtn;
            scrollerVert.BottomButton = bottomBtn;
            //VerticalScrollBar scrollerVert = new VerticalScrollBar();
            //scrollerVert.MinusBtn = topBtn;
            //scrollerVert.PlusBtn = bottomBtn;

            ComposedScroller scroller = new ComposedScroller();
            scroller.Scrollers = new IScroller[] { scrollerHor, scrollerVert };


            AgBehavior content=new AgBehavior();
            content.ElementName = "Content";
            content.Plugin = Plugin;
            content.Initialize();

            ScrollContainer scrollContainer = new ScrollContainer();
            scrollContainer.ElementName = "Container";
            scrollContainer.Content = content;
            scrollContainer.Plugin = Plugin;
            scrollContainer.Scroller = scroller;
            scrollContainer.Initialize();
        }
    }
}